package com.ljl.ningwei.mapper;


import com.ljl.ningwei.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 物料表接口
 */
public interface UserMapper {

    @Select("select " +
            "id as id,\n" +
            "name as name,\n" +
            "account as account,\n" +
            "password as password,\n" +
            "phone as phone,\n" +
            "avatar as avatar,\n" +
            "create_time as createTime,\n" +
            "update_time as updateTime,\n" +
            "is_deleted as isDeleted " +
            "from user where id = #{id} and `is_deleted` = 0")
    User getById(@Param("id") Long id);

    @Select("select " +
            "id as id,\n" +
            "name as name,\n" +
            "account as account,\n" +
            "password as password,\n" +
            "phone as phone,\n" +
            "avatar as avatar,\n" +
            "create_time as createTime,\n" +
            "update_time as updateTime,\n" +
            "is_deleted as isDeleted " +
            "from user where id = #{id} ")
    User extractById(@Param("id") Long id);




    int update(User material);

    int insert(User material);

    User query(User user);
    @Update(" UPDATE\n" +
            "            user\n " +
            "        SET\n" +
            "            `is_deleted` = 1\n" +
            "        WHERE  id = #{id}")
    int delete(@Param("id") Long id);

}
